<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
    <div class="breadcrumb">
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
        <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
        <?php } ?>
    </div>
    <div id="community">
        <div id="forum-header">
            <?php echo $community_header; ?>
            <?php if ($text_forum_points_awarded) { ?>
            <div class="success" id="forum-points-awarded"><?php echo $text_forum_points_awarded; ?><img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>
            <?php } ?>
            <div>
                <h1>
                    <a href="<?php echo $headline_link; ?>"><?php echo $headline_name; ?></a>
                    <?php if($is_user_login){ ?>
                    <form action="<?php echo $subscribe_action_link; ?>" method="post">
                        <input type="submit" id="<?php echo $text_subsribe_name; ?>" name="<?php echo $text_subsribe_name; ?>" value="<?php echo $text_subscribe; ?>" title="<?php echo $text_subscribe; ?>" />
                    </form>
                    <?php } ?>
                </h1>
                <?php if($mods){ ?>
                <div style="margin-bottom:10px;">
                    <?php echo $text_forum_mod; ?>
                    <?php foreach($mods as $mod){ ?>
                    <a href="<?php echo $mod['user_link']; ?>"><?php echo $mod['username']; ?></a>
                    <?php } ?>
                </div>
                <?php } ?>
                <?php if($sub_forums){ ?>
                <div class="gray-box">
                    <dl class="gray-box-heading">
                        <dt class="gray-box-heading-first"><?php echo $text_forum; ?></dt>
                        <dd class="gray-box-heading-second"><?php echo $text_topics; ?></dd>
                        <dd class="gray-box-heading-third"><?php echo $text_posts; ?></dd>
                        <dd class="gray-box-heading-forth"><?php echo $text_latest_post; ?></dd>
                    </dl>
                    <?php $f=0; ?>
                    <?php foreach($sub_forums as $sub_forum){ ?>
                    <dl class="gray-box-content <?php echo $forumStatus[$f]; ?>" title="<?php echo $text_forum_status[$f]; ?>">
                        <dt class="gray-box-content-first">
                            <span><strong><a href="<?php echo $sub_forum['forum_link']; ?>"><?php echo $sub_forum['forum_name']; ?></a></strong></span>
                            <span><?php echo $sub_forum['forum_desc']; ?></span>
                        </dt>
                        <dd class="gray-box-content-second"><?php echo $sub_forum['forum_topics']; ?></dd>
                        <dd class="gray-box-content-third"><?php echo $sub_forum['forum_posts']; ?></dd>
                        <dd class="gray-box-content-forth">
                            <?php if($sub_forum['forum_posts']>0){ ?>
                            <?php echo $text_by; ?>&nbsp;<a href="<?php echo $sub_forum['user_link']; ?>"><?php echo $sub_forum['forum_last_poster_name']; ?></a><br />
                            <?php echo $sub_forum['forum_last_post_time']; ?>
                            <?php }else{ ?>
                            <?php echo $text_never; ?>
                            <?php } ?>
                        </dd>
                    </dl>
                    <?php $f++; ?>
                    <?php } ?>
                </div>
                <?php } ?>
                <?php if($allow_topic){ ?>
                <a class="topic-button" href="<?php echo $new_topic_link; ?>"></a>
                <?php } ?>
                <div class="forum-pagination"><?php echo $pagination; ?></div>
            </div>
        </div>
        <div id="topic-cat">
            <span><?php echo $text_topic_cat; ?></span>
            <a class="<?php echo $all_topic_link_status; ?>" href="<?php echo $headline_link; ?>"><?php echo $text_all_topics; ?></a>
            <a class="<?php echo $featured_topic_link_status; ?>" href="<?php echo $featured_topic_link; ?>"><?php echo $text_featured_topics; ?></a>
            <a class="<?php echo $polled_topic_link_status; ?>" href="<?php echo $polled_topic_link; ?>"><?php echo $text_polled_topics; ?></a>
            <?php if($topic_category_enabled){ ?>
            <?php foreach($topic_cats as $topic_cat){ ?>
            <a class="<?php echo $topic_cat['topic_cat_link_status']; ?>" href="<?php echo $topic_cat['topic_category_link']; ?>"><?php echo $topic_cat['topic_category_title']; ?></a>
            <?php } ?>
            <?php } ?>
        </div>
        <?php if($announcement_topics) {?>
        <div class="gray-box">
            <dl class="gray-box-heading">
                <dt class="gray-box-heading-first"><?php echo $text_announcement; ?></dt>
                <dd class="gray-box-heading-second"><?php echo $text_replies; ?></dd>
                <dd class="gray-box-heading-third"><?php echo $text_views; ?></dd>
                <dd class="gray-box-heading-forth"><?php echo $text_last_post; ?></dd>
            </dl>
            <?php $i=0; ?>
            <?php foreach($announcement_topics as $announcement_topic){ ?>
            <dl class="gray-box-content <?php echo $announcementTopicStatus[$i]; ?> <?php echo $announcement_topic['is_featured'] ? 'topic-featured' : ''; ?> <?php echo $announcement_topic['is_reported'] ? 'topic_reported' : ''; ?>" title="<?php echo $text_announcement_topic_status[$i]; ?>">
                <dt class="gray-box-content-first">
                    <span>
                        <a href="<?php echo $announcement_topic['viewtopic_link']; ?>"><?php echo $announcement_topic['topic_title']; ?></a>
                        <?php echo $announcement_topic['is_reported'] ? '&nbsp;<a title="' . $text_topic_reported . '" href="' . $reported_topic_link . '"><img style="vertical-align:middle;" src="catalog/view/theme/default/image/post/icon_topic_reported.gif" /></a>' : ''; ?>
                    </span>
                    <span><a href="<?php echo $announcement_topic['topic_poster_link']; ?>"><?php echo $announcement_topic['username']; ?></a> &raquo; <?php echo $announcement_topic['topic_time']; ?> <?php echo $announcement_topic['topic_pagination_link']; ?></span>
                </dt>
                <dd class="gray-box-content-second"><?php echo $announcement_topic['topic_replies']; ?></dd>
                <dd class="gray-box-content-third"><?php echo $announcement_topic['topic_views']; ?></dd>
                <dd class="gray-box-content-forth">
                    <?php echo $text_by; ?>&nbsp;<a href="<?php echo $announcement_topic['topic_last_poster_link']; ?>"><?php echo $announcement_topic['topic_last_poster_name']; ?></a><br />
                    <?php echo $announcement_topic['topic_last_post_time']; ?>
                </dd>
            </dl>
            <?php $i++; ?>
            <?php } ?>
        </div>
        <?php } ?>
        <div class="gray-box">
            <dl class="gray-box-heading">
                <dt class="gray-box-heading-first"><?php echo $text_topics; ?></dt>
                <dd class="gray-box-heading-second"><?php echo $text_replies; ?></dd>
                <dd class="gray-box-heading-third"><?php echo $text_views; ?></dd>
                <dd class="gray-box-heading-forth"><?php echo $text_last_post; ?></dd>
            </dl>
            <?php if($has_topics){?>
            <?php $i=0; ?>
            <?php foreach($topics as $topic){ ?>
            <dl class="gray-box-content <?php echo $topicStatus[$i]; ?> <?php echo $topic['is_reported'] ? 'topic_reported' : ''; ?>" title="<?php echo $text_topic_status[$i]; ?>">
                <dt class="gray-box-content-first <?php echo $topic['is_solved'] ? 'topic-solved' : ''; ?>">
                    <?php if(isset($topic['topic_product_image'])){ ?>
                    <span class="topic-product-thumbnail"><img src="<?php echo $topic['topic_product_image']; ?>" /></span>
                    <?php } ?>
                    <span>
                       <?php if($topic_category_enabled && $topic['topic_category_displayed']){ ?>
                           <?php if($topic['topic_category_title']){ ?>
                            &#91;<a href="<?php echo $topic['topic_category_link']; ?>"><?php echo $topic['topic_category_title']; ?></a>&#93;&nbsp;
                           <?php } ?>
                        <?php } ?>
                        <a href="<?php echo $topic['viewtopic_link']; ?>"><?php echo $topic['topic_title']; ?></a>
                        <?php echo $topic['is_featured'] ? '&nbsp;<img style="vertical-align:middle;" src="catalog/view/theme/default/image/post/topic-featured.gif" />' : ''; ?>
                        <?php echo $topic['is_reported'] ? '&nbsp;<a title="' . $text_topic_reported . '" href="' . $reported_topic_link . '"><img style="vertical-align:middle;" src="catalog/view/theme/default/image/post/icon_topic_reported.gif" /></a>' : ''; ?>
                    </span>
                    <span>
                        <a href="<?php echo $topic['topic_poster_link']; ?>"><?php echo $topic['username']; ?></a> &raquo; <?php echo $topic['topic_time']; ?>
                        <?php if($topic['topic_rating']){ ?>
                        <img style="margin-left:10px;vertical-align:middle;" src="catalog/view/theme/default/image/stars-<?php echo $topic['topic_rating']; ?>.png" />
                        <?php } ?>
                        <?php echo $topic['topic_pagination_link']; ?>
                    </span>
                </dt>
                <dd class="gray-box-content-second"><?php echo $topic['topic_replies']; ?></dd>
                <dd class="gray-box-content-third"><?php echo $topic['topic_views']; ?></dd>
                <dd class="gray-box-content-forth">
                    <?php echo $text_by; ?>&nbsp;<a href="<?php echo $topic['topic_last_poster_link']; ?>"><?php echo $topic['topic_last_poster_name']; ?></a><br />
                    <?php echo $topic['topic_last_post_time']; ?>
                </dd>
            </dl>
            <?php $i++; ?>
            <?php } ?>
            <?php }else{ ?>
            <dl class="gray-box-content">
                <dd><?php echo $text_no_topics; ?></dd>
            </dl>
            <?php } ?>
        </div>
        <?php if($allow_topic){ ?>
        <a class="topic-button" href="<?php echo $new_topic_link; ?>"></a>
        <?php } ?>
        <div class="forum-pagination"><?php echo $pagination; ?></div>
    </div>
<?php  echo $footer; ?>
<script type="text/javascript"><!--
<?php if ($text_forum_points_awarded) { ?>
setTimeout(function(){$('#forum-points-awarded').hide();}, 7000);
<?php } ?>
$(document).ready(
    function(){
        $(".gray-box-content").filter(":even").mouseover(function() {
            $(this).css("background-color", "#FFFFDB");
        }).mouseout(function(){
                $(this).css("background-color", "");
            });

        $(".gray-box-content").filter(":odd").mouseover(function() {
            $(this).css("background-color", "#FFFFDB");
        }).mouseout(function(){
                $(this).css("background-color", "");
            });
    });

$('#community input[name=\'header-keyword\']').keydown(function(e) {
    if (e.keyCode == 13) {
        $('#header-search-button').trigger('click');
    }
});

$('#header-search-button').bind('click', function() {
    url = 'index.php?route=community/search';

    var keyword = $('#forum-header-bar-search input[name=\'header-keyword\']').attr('value');

    url += '&kw=' + encodeURIComponent(keyword) + '&sw=psm&sb=lpt&or=desc&lr=all';

    location = url;
});
//--></script>
<script type="text/javascript" src="catalog/view/javascript/forum_fn.js"></script>